import { Logger } from "../engine/utils/Logger";

const request = require('request');

export class HttpHelper {

    public static url:string = "http://api.tushare.pro"
    public static token:string = "f698b2b8a7463e5fc66a7e0add1d32d7ce5bce54ac11291d3505193a"

    public static sendHttpRequest(params: object, url: string, callback: Function = null) {
        let options = {
            url: url,
            headers: {
                'Content-Type': 'application/json',
                // "Authorization":"",
            },
            body: JSON.stringify(params)
            // body: params
        };
        request.post(options, (err, response, body) => {
            // Logger.log("sendHttpRequest ==1===", err)
            // Logger.log("sendHttpRequest ===2==", response)
            // Logger.log("sendHttpRequest ===3==", body)
            callback && callback(response, body)
        });
    }



}